class Solution {
public:
    int lengthOfLIS(std::vector<int>& nums) {
        if (nums.size() == 0) 
        {
            return 0;
        }
        std::vector<int> dp(nums.size(), 0);
        dp[0] = 1;
        for (int i = 1; i < nums.size(); ++i) 
        {
            int tmp_max_increased_count = 0;
            for (int j = 0; j < i; ++j) 
            {
                if (nums[i] > nums[j]) 
                {
                    tmp_max_increased_count = std::max(tmp_max_increased_count, dp[j]);
                }
            }
            dp[i] = tmp_max_increased_count + 1;
        }
        int result = 0;
        for (int val : dp) 
        {
            result = std::max(result, val);
        }
        return result;
    }
};
